package com.onlyxiahui.extend.query.hibernate;

import java.util.HashMap;
import java.util.Map;

import com.onlyxiahui.extend.query.page.DefaultPage;
import com.onlyxiahui.extend.query.page.QueryPage;

/**
 * 
 * Date 2018-12-28 17:00:04<br>
 * Description
 * 
 * @author XiaHui<br>
 * @since 1.0.0
 */
public class QueryWrapper {

	private Map<String, Object> parameterMap = new HashMap<String, Object>();
	private QueryPage page;

	public Map<String, Object> getParameterMap() {
		return parameterMap;
	}

	public void addParameter(String key, Object value) {
		parameterMap.put(key, value);
	}

	public Object getParameter(String key) {
		return parameterMap.get(key);
	}

	public void put(String key, Object value) {
		parameterMap.put(key, value);
	}

	public Object get(String key) {
		return parameterMap.get(key);
	}

	public QueryPage getPage() {
		return page;
	}

	public void setPage(QueryPage page) {
		this.page = page;
	}

	public QueryPage setPage(int pageNumber, int pageSize) {
		if (null == page) {
			page = new DefaultPage();
		}
		page.setPageNumber(pageNumber);
		page.setPageSize(pageSize);
		return page;
	}
}
